package com.twotwoshop.fegin.api.goods;


import com.twotwoshop.commom.annotation.BrowsingHistoryAnnotation;
import com.twotwoshop.domin.common.dtos.ResponseResult;
import com.twotwoshop.domin.goods.dtos.ProductDto;
import com.twotwoshop.fegin.api.config.FeignInterceptor;
import com.twotwoshop.fegin.api.goods.fallback.IGoodsClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 用户远程调用
 */                                                            //实现服务降级
@FeignClient(value = "twotwo-service-goods",path ="/goods" , fallback = IGoodsClientFallback.class,configuration = FeignInterceptor.class)
public interface IGoodsClient {



    /**
     * 根据用户id获取发布商品
     * @return
     */
    @PostMapping("/byUserid/list/{userId}")
    public ResponseResult listProductsByUserId(@PathVariable("userId") Long userId);


    /**
     * 获取商品详情信息
     * @return
     */
    @GetMapping("/order/{id}")
    public ResponseResult ProductById(@PathVariable("id") Long id);



    /**
     * 上下架商品
     *
     * @param productDto
     * @return
     */
    @PostMapping("/status")
    public ResponseResult updateStatus(@RequestBody ProductDto productDto);
}



